package com.biblioteca.servicio;

import com.biblioteca.dao.RolDao;
import com.biblioteca.persistencia.Rol;
import com.google.appengine.api.datastore.Key;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Service;


@Service("RolServicio")
public class RolServicioImpl implements RolServicio {
    
    private RolDao rolDao;
    
    @Autowired
    @Required
    public void setPrestamoDao(RolDao rolDao) {
        this.rolDao = rolDao;
    }
    
    @Override
    public void create(final Rol rol) {
        rolDao.insert(rol);
    }

    @Override
    public Rol getRol(Key keyRol) {
        return rolDao.find(Rol.class, keyRol);    
    }

    @Override
    public Collection<Rol> getAllRoles(){
         return rolDao.getAll(Rol.class);
    }
   
}
